home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Communications
/
Network
/
MacHTTP 1.2.4
/
search.script
< prev
Wrap
Text File
|
1994-02-23
|
1KB
|
21 lines
-- This script demonstrates accessing searchable files from MacHTTP.
-- (What it really shows is how to pass arguments to AppleScripts.)
-- http_search_args is a predefined variable that is passed from the server
-- to the script and contains the user-supplied arguments. If the arguments
-- are empty, the script asks the WWW client to prompt for them.
-- If arguments were passed, then the script behaves accordingly.
-- Note: the <ISINDEX> HTML tag is what tells the client the document is searchable
-- and arguments should be collected and passed.
set crlf to (ASCII character 13) & (ASCII character 10)
set http_10_header to "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & ¬
"MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
if http_search_args = "" then
return http_10_header & "<ISINDEX><h2>Please enter the keyword to search for.</h2>"
else if http_search_args = "hello" then
return http_10_header & "<h2>Hello, how are you?</h2>"
else
return http_10_header & "<h2>Sorry, I don't understand '" & ¬
http_search_args & "'. Try 'hello' instead.</h2>"
end if